
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>文章编辑后台管理页面-Powered by owen</title>

    <link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.3.3/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.3.3/themes/icon.css">
    <script type="text/javascript" src="/static/jquery-easyui-1.3.3/jquery.min.js"></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
    <script type="text/javascript">

        function tabsClose(){
            var tab=$('#tabs').tabs('getSelected');//获取当前选中tabs
            var index = $('#tabs').tabs('getTabIndex',tab);//获取当前选中tabs的index
            $('#tabs').tabs('close',index);//关闭对应index的tabs
            addTab('诗歌列表','/news/blogManage');
        }
        function refresh(title, url){

                var content ="<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%' src='"+url+"'></iframe>";
                $('#tabs').tabs('update',{
                    title:title,
                    content:content,
                    closable:true
                });

        }
        function addTab(title, url){
            if ($('#tabs').tabs('exists', title)){
                refresh('诗歌列表','/news/blogManage');
           } else {
                var content ="<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%' src='"+url+"'></iframe>";
                $('#tabs').tabs('add',{
                    title:title,
                    content:content,
                    closable:true
                });
           }
        }

        var url;

        function openTab(text,url,iconCls){
            if($("#tabs").tabs("exists",text)){
                $("#tabs").tabs("select",text);
            }else{
                var content="<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%' src='"+url+"'></iframe>";
                $("#tabs").tabs("add",{
                    title:text,
                    iconCls:iconCls,
                    closable:true,
                    content:content
                });
            }
        }


        function openPasswordModifyDialog(){
            $("#dlg").dialog("open").dialog("setTitle","推荐微信号设置");
            url="/users/weixin/<?php echo $id ?>";
        }

        function modifyPassword(){
            $("#fm").form("submit",{
                url:url,
                onSubmit:function(){
                   /* var newPassword=$("#newPassword").val();
                    var newPassword2=$("#newPassword2").val();
                    if(!$(this).form("validate")){
                        return false;
                    }
                    if(newPassword!=newPassword2){
                        $.messager.alert("系统提示","确认密码输入错误！");
                        return false;
                    }*/
                    return true;
                },
                success:function(result){
                    var result=eval('('+result+')');
                    if(result.success){
                        $.messager.alert("系统提示","微信号设置成功！");
                        resetValue();
                        $("#dlg").dialog("close");
                    }else{
                        $.messager.alert("系统提示","微信号设置失败！");
                        return;
                    }
                }
            });
        }

        function closePasswordModifyDialog(){
            resetValue();
            $("#dlg").dialog("close");
        }

        function resetValue(){
            $("#oldPassword").val("");
            $("#newPassword").val("");
            $("#newPassword2").val("");
        }

        function logout(){
            $.messager.confirm("系统提示","您确定要退出系统吗？",function(r){
                if(r){
                    window.location.href='/index.php/users/logout';
                }
            });
        }

        function refreshSystem(){
            $.post("/users/refresh",{},function(result){
                if(result.success){
                    $.messager.alert("系统提示","已成功刷新系统缓存！");
                }else{
                    $.messager.alert("系统提示","刷新系统缓存失败！");
                }
            },"json");
        }

    </script>
</head>
<body class="easyui-layout">
<div region="north" style="height: 78px;background-color: #E0ECFF">
    <table style="padding: 5px" width="100%">
        <tr>
            <td width="50%">
                <img alt="logo" src="<?php echo  base_url() ;?>/static/images/logo.png">
            </td>
            <td valign="bottom" align="right" width="50%">
                <font size="3">&nbsp;&nbsp;<strong>欢迎：</strong><?php echo $userName?></font>
            </td>
        </tr>
    </table>
</div>
<div region="center">
    <div class="easyui-tabs" fit="true" border="false" id="tabs">
        <div title="首页" data-options="iconCls:'icon-home'">
            <div align="center" style="padding-top: 100px"><font color="red" size="10">欢迎使用</font></div>
        </div>
    </div>
</div>
<div region="west" style="width: 200px" title="导航菜单" split="true">
    <div class="easyui-accordion" data-options="fit:true,border:false">
        <div title="资源管理"  data-options="iconCls:'icon-bkgl'" style="padding:10px;">
            <a href="javascript:openTab('上传诗歌','/news/write135','icon-writeblog')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-writeblog'" style="width: 150px;">上传诗歌</a>
            <a href="javascript:openTab('诗歌列表','/news/blogManage','icon-bkgl')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-bkgl'" style="width: 150px;">诗歌列表</a>
        </div>
        <div title="系统管理"  data-options="iconCls:'icon-system'" style="padding:10px">
            <a href="javascript:openPasswordModifyDialog()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-modifyPassword'" style="width: 150px;">推荐微信号设置</a>
            <a href="javascript:refreshSystem()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-refresh'" style="width: 150px;">刷新系统缓存</a>
            <a href="javascript:logout()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-exit'" style="width: 150px;">安全退出</a>
        </div>
    </div>
</div>
<div region="south" style="height: 25px;padding: 5px" align="center">
    Copyright © 2012-2018XXXXXX 版权所有
</div>

<div id="dlg" class="easyui-dialog" style="width:400px;height:200px;padding: 10px 20px"
     closed="true" buttons="#dlg-buttons">

    <form id="fm" method="post">
        <table  cellspacing="8px">
           <!-- <tr>
                <td>用户名：</td>
                <td><input type="text" id="userName" name="userName" readonly="readonly" value= "<?php /*echo $userName*/?>"/></td>
            </tr>-->
            <tr>
                <td>推荐微信名称：</td>
                <td><input type="text" id="r_name" name="r_name" class="easyui-validatebox" required="true" style="width: 200px"/></td>
            </tr>
            <tr>
                <td>推荐微信号：</td>
                <td><input type="text" id="r_id" name="r_id" class="easyui-validatebox" required="true" style="width: 200px"/></td>
            </tr>
            <tr>
                <td>广告语：</td>
                <td><input type="text" id="r_ad" name="r_ad" class="easyui-validatebox" required="true" style="width: 200px"/></td>
            </tr>
        </table>
    </form>
</div>

<div id="dlg-buttons">
    <a href="javascript:modifyPassword()" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
    <a href="javascript:closePasswordModifyDialog()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
</div>

</body>
</html>